interface DatabaseConfig {
  type: 'mysql';
  host: string;
  port: number;
  username: string;
  password: string;
  database: string;
  synchronize: boolean;
  logging: boolean;
  charset: string;
}

interface JwtConfig {
  secret: string;
  expiresIn: string;
}

interface Config {
  port: number;
  database: DatabaseConfig;
  jwt: JwtConfig;
}

export default (): Config => ({
  port: parseInt(process.env.PORT || '3000', 10),
  database: {
    type: 'mysql',
    host: process.env.DB_HOST || 'localhost',
    port: parseInt(process.env.DB_PORT || '3306', 10),
    username: process.env.DB_USERNAME || 'root',
    password: process.env.DB_PASSWORD || 'root',
    database: process.env.DB_DATABASE || 'multi_shop_db',
    // synchronize: process.env.NODE_ENV !== 'production',
    synchronize: true,
    logging: process.env.NODE_ENV !== 'production',
    charset: 'utf8mb4',
  },
  jwt: {
    secret: process.env.JWT_SECRET || 'your-secret-key',
    expiresIn: process.env.JWT_EXPIRES_IN || '24h',
  },
}); 